package com.sysmanagment.model.user;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

import org.jboss.seam.annotations.security.management.RoleConditional;
import org.jboss.seam.annotations.security.management.RoleGroups;
import org.jboss.seam.annotations.security.management.RoleName;

import com.sysmanagment.model.SgtEntity;
@Entity
public class Role extends SgtEntity implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 9180331154584991827L;
	private String rolename;
	private boolean conditional;
	private List<Role> groups;
	
	
	@RoleName
	public String getRolename() {
		return rolename;
	}

	public void setRolename(String rolename) {
		this.rolename = rolename;
	}

	@RoleConditional
	public boolean isConditional() {
		return conditional;
	}

	public void setConditional(boolean conditional) {
		this.conditional = conditional;
	}

	@RoleGroups
	@ManyToMany(targetEntity = Role.class)
	@JoinTable(name = "RoleGroups", joinColumns = @JoinColumn(name = "RoleId"), inverseJoinColumns = @JoinColumn(name = "GroupId"))
	public List<Role> getGroups() {
		return groups;
	}

	public void setGroups(List<Role> groups) {
		this.groups = groups;
	}

}